import axios from 'axios'
// import qs from 'qs'
let instance = axios.create({
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    }
  })
  instance.interceptors.request.use(
    config => {
        // 验证一些信息不符合要求进行拦截
        console.log(config) 
      return config
    },
    err => {
      return Promise.reject(err)
    })
let ajax = ({method,url,params,data,success,error})=>{
    instance({
         method,
         url,
         params,
         data
     })
     .then(res=>{
       success(res.data)
     })
     .catch(err=>{
         console.log(123)
        error(err)
     })
 }

 export default ajax